<template>
  <el-card>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="评分管理" name="score_manage" />
      <el-tab-pane label="检验指标" name="test_indicators" />
      <el-tab-pane label="检查印象" name="check_impression" />
      <el-tab-pane label="药品信息" name="drug_information" />
      <el-tab-pane label="设置必填项" name="set_mandeld" />
      <el-tab-pane label="归档设置" name="archive_Setting" />
      <el-tab-pane label="档案管理" name="file_management" />
      <el-tab-pane label="快速给药" name="rapid_dispensing" />
      <el-tab-pane label="绿道时间" name="green_time" />
      <el-tab-pane label="治疗方案" name="treatment_plan" />
      <el-tab-pane label="知情同意" name="informed_consent" />
      <el-tab-pane label="随访问卷" name="followUp_questionnaire" />
      <el-tab-pane label="短信通知" name="short_note" />
    </el-tabs>
    <component :is="activeName" />
  </el-card>
</template>

<script>
import score_manage from "@/views/back-management/greenway-set/Score_manage";
import test_indicators from "@/views/back-management/greenway-set/Test_indicators";
import check_impression from "@/views/back-management/greenway-set/Check_impression";
import drug_information from "@/views/back-management/greenway-set/Drug_information";
import set_mandeld from "@/views/back-management/greenway-set/Set_mandeld";
import archive_Setting from "@/views/back-management/greenway-set/Archive_Setting";
import file_management from "@/views/back-management/greenway-set/File_management";
import rapid_dispensing from "@/views/back-management/greenway-set/rapid_dispensing";
import treatment_plan from "@/views/back-management/greenway-set/treatment_plan";
import informed_consent from "@/views/back-management/greenway-set/informed_consent";
import green_time from "@/views/back-management/greenway-set/green_time";
import followUp_questionnaire from "./followUp_questionnaire";
import short_note from "./short_note";

export default {
  name: "GreenwaySet",
  components: {
    score_manage,
    test_indicators,
    check_impression,
    drug_information,
    set_mandeld,
    archive_Setting,
    file_management,
    rapid_dispensing,
    treatment_plan,
    informed_consent,
    green_time,
    followUp_questionnaire,
    short_note,
  },
  data() {
    return {
      activeName: "score_manage",
    };
  },

  created() {
    // 添加刷新监听,刷新后保持tab页选中
    window.addEventListener("beforeunload", (e) => this.beforeunloadFn(e));
    this.activeName = sessionStorage.getItem("activeName") || this.activeName;
  },
  beforeDestroy() {
    // 卸载监听事件
    window.removeEventListener("beforeunload", (e) => this.beforeunloadFn(e));
    // 清除sessionStorage
    sessionStorage.removeItem("activeName");
  },
  methods: {
    handleClick(tab, event) {
      // console.log(tab, event)
    },
    // 存储sessionStorage
    beforeunloadFn(e) {
      sessionStorage.setItem("activeName", this.activeName);
      // console.log('刷新或关闭')
    },
  },
};
</script>

  <style>
</style>
